package com.cnware.capture.ui.view.navigator;

import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;

public class NavContentProvider implements ITreeContentProvider {

	@Override
	public void dispose() {
	}

	@Override
	public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {

	}

	@Override
	public Object[] getElements(Object inputElement) {
		return getChildren(inputElement);
	}

	@Override
	public Object[] getChildren(Object parentElement) {
		if(parentElement instanceof NavigatorItem){
			return ((NavigatorItem)parentElement).getChildren();
		} else {
			return new Object[0];
		}
	}

	@Override
	public Object getParent(Object element) {
		if(element instanceof NavigatorItem){
			return ((NavigatorItem)element).getParent();
		}
		return null;
	}

	@Override
	public boolean hasChildren(Object element) {
		return ((NavigatorItem)element).hasChildred();
	}

}
